今天遇到的问题也有点奇葩,哈哈,本来想的将数据分成两份,这样就可以各司其职了,可是半路杀出个错误,得不到结论!!!
这个代码块只负责数据列表中查看和修改的功能(如果用用这个sql语句查询数据列表的话,数据回显就显得那么力不从心了)
<sql id="selectSydjBirthRegVo">
select reg.id, reg.birthid, reg.userid, reg.reg_date, reg.marriage, reg.marriage_date, reg.couple, reg.certificate, reg.fertility,
reg.fertility_again, reg.children_order, reg.place, reg.accepted, reg.receive, reg.issure, reg.status, reg.source, reg.push, reg.insertdate, reg.remark,
man.`name`,man.idcard,man.tel,woman.`name`,woman.idcard,woman.tel,result.status
from ((sydj_birth_reg reg LEFT JOIN sydj_birth_reg_man man on reg.id=man.regid)
LEFT JOIN sydj_birth_reg_woman woman ON reg.id=woman.regid) left join sydj_check_result result on reg.id=result.regid
</sql>
<select id="selectSydjBirthRegById" parameterType="Long" resultMap="SydjBirthRegResultOld">
<include refid="selectSydjBirthRegVo"/>
where reg.id = #{id}
</select>
这个代码块负责数据列表的查询,只是为了让数据列表更快(实际上是将数据整合到一张表上了而已,提高查询速率)
<sql id="selectSydjBirthRegVoNew">
select id, birthid, userid, reg_date, marriage, marriage_date, couple, certificate, fertility, fertility_again, children_order, place, accepted,
receive, issure, status, source, push,accepted_name,man_name,man_idcard,man_phone,woman_name,woman_idcard,woman_phone ,insertdate, remark,check_date,birth_number,check_reason
from sydj_birth_reg
</sql>
当我们在判断如何获取数据库中的值时,可能字典中有多个键值,而我们恰好只需要其中的一两个数据,如图:
处理如下:配置文件中代码 (直接将可变参数的值既定,在下面的值中取订)
<if test="params.status != null and params.status != ''"> and status=1 or status=5</if>
页面取值代码(只需要动态的取值name值,value只是一个标志,没有用到) <input type="hidden" name="params[status]" value="1,5">